<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>&lt;regex.h&gt;</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_008_033">&nbsp;</a>NAME</h4><blockquote>
regex.h - regular-expression-matching types
</blockquote><h4><a name = "tag_000_008_034">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;regex.h&gt;
</code>
</pre>
</blockquote><h4><a name = "tag_000_008_035">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>&lt;regex.h&gt;</i>
header defines the structures and symbolic constants used by the
<i><a href="regcomp.html">regcomp()</a></i>,
<i><a href="regexec.html">regexec()</a></i>,
<i><a href="regerror.html">regerror()</a></i>
and
<i><a href="regfree.html">regfree()</a></i>
functions.
<p>
The structure type
<b>regex_t</b>
contains at least the following member:
<pre>
<code>
size_t    re_nsub    number of parenthesised subexpressions
</code>
</pre>
<p>
The type <b>regoff_t</b> is defined as a signed arithmetic type that can hold
the largest value that can be stored in either a type <b>off_t</b> or type
<b>ssize_t</b>.
The structure type
<b>regmatch_t</b>
contains at least the following members:
<pre>
<code>
regoff_t    rm_so    byte offset from start of <i>string</i>
                     to start of substring
regoff_t    rm_eo    byte offset from start of <i>string</i>
                     of the first character after the end of substring
</code>
</pre>
<p>
Values for the
<i>cflags</i>
parameter to the
<i><a href="regcomp.html">regcomp()</a></i>
function:
<dl compact>

<dt>REG_EXTENDED<dd>
Use Extended Regular Expressions.

<dt>REG_ICASE<dd>
Ignore case in match.

<dt>REG_NOSUB<dd>
Report only success or fail in
<i><a href="regexec.html">regexec()</a></i>.

<dt>REG_NEWLINE<dd>
Change the handling of newline.

</dl>
<p>
Values for the
<i>eflags</i>
parameter to the
<i><a href="regexec.html">regexec()</a></i>
function:
<dl compact>

<dt>REG_NOTBOL<dd>
The circumflex character (^),
when taken as a special character, will not match
the beginning of
<i>string</i>.

<dt>REG_NOTEOL<dd>
The dollar sign ($),
when taken as a special character, will not match
the end of
<i>string</i>.

</dl>
<p>
The following constants are defined as error return values:
<dl compact>

<dt>REG_NOMATCH<dd>
<i><a href="regexec.html">regexec()</a></i>
failed to match.

<dt>REG_BADPAT<dd>
Invalid regular expression.

<dt>REG_ECOLLATE<dd>
Invalid collating element referenced.

<dt>REG_ECTYPE<dd>
Invalid character class type referenced.

<dt>REG_EESCAPE<dd>
Trailing \ in pattern.

<dt>REG_ESUBREG<dd>
Number in \<i>digit</i> invalid or in error.

<dt>REG_EBRACK<dd>
[ ] imbalance.

<dt>REG_EPAREN<dd>
\( \) or ( ) imbalance.

<dt>REG_EBRACE<dd>
\{ \} imbalance.

<dt>REG_BADBR<dd>
Content of \{ \} invalid:
not a number,
number too large, more than two numbers, first
larger than second.

<dt>REG_ERANGE<dd>
Invalid endpoint in range expression.

<dt>REG_ESPACE<dd>
Out of memory.

<dt>REG_BADRPT<dd>
?, * or + not preceded by valid regular expression.

<dt>REG_ENOSYS<dd>
The implementation does not support the function.

</dl>
<p>
The following are declared as functions and may also be declared as macros.
Function prototypes must be provided for use with an ISO C
compiler.
<pre>
<code>
int    <a href="regcomp.html">regcomp</a>(regex_t *, const char *, int);
int    <a href="regexec.html">regexec</a>(const regex_t *, const char *, size_t, regmatch_t[], int);
size_t <a href="regerror.html">regerror</a>(int, const regex_t *, char *, size_t);
void   <a href="regfree.html">regfree</a>(regex_t *);
</code>
</pre>
<p>
The implementation may define additional macros or constants
using names beginning with REG_.
</blockquote><h4><a name = "tag_000_008_036">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_008_037">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_008_038">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="regcomp.html">regcomp()</a></i>,
the <b>XCU</b> specification.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
